<?php
/**
  * Mar 11, 2008
  *
  * Coded by: Ropu
  *
  */

class Hi5Feed extends Hi5 {
  
  public function __construct($api_key, $uid, $hi5AuthToken=null) {
    parent::__construct($api_key, $uid, $hi5AuthToken);
  
  }

  public function friends() {
    try {
      return Http::get("http://api.hi5.com/" . $this->type . "/feeds/people/" . $this->uid . "/friends",
	                      array("Hi5AuthToken" => $this->Hi5AuthToken)
	                      ); 
	  } catch (HttpException $e) {
      switch($e->getCode()) {
        case '403':
          throw new PermissionDeniedException($e->getMessage(), '403');
          break;
        default:
          throw new Exception($e->getMessage(), $e->getCode());
          break;
      }
    }
  }

  public function photosFriends($friend, $display_all=1, $friends=1) {
    try {
      return Http::get("http://api.hi5.com/" . $this->type . "/photos/public", // . $friend ,
	                      array("Hi5AuthToken" => $this->Hi5AuthToken,
	                            "user_id" => $friend,
	                            "id" => $friend,
	                            "display_all" => $display_all,
	                            "friends" => $friends)
	                      ); 
	  } catch (HttpException $e) {
      switch($e->getCode()) {
        case '403':
          throw new PermissionDeniedException($e->getMessage(), '403');
          break;
        default:
          throw new Exception($e->getMessage(), $e->getCode());
          break;
      }
    }
  }
}
